﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HotelManageSystem.Domain.Infrastructure;
using HotelManageSystem.Domain;


namespace HotelManageSystem.Domain.Infrastructure
{
    public class UnitOfWork : IUnitOfWork
    {
        private readonly IDatabaseFactory databaseFactory;
        private HotelManageSystemDbContext dataContext;
        public UnitOfWork(IDatabaseFactory databaseFactory)
        {
            this.databaseFactory = databaseFactory;
        }
        protected HotelManageSystemDbContext DataContext { get { return dataContext ?? (dataContext = databaseFactory.Get()); } }
        //实现接口
        public void Commit()
        {
            DataContext.Commit();
        }
    }

}
